package com.quartz.SpringBootQuartz.service.serviceImpl;

import com.quartz.SpringBootQuartz.entity.Cron;
import com.quartz.SpringBootQuartz.entity.JobEntity;
import com.quartz.SpringBootQuartz.mapper.JobEntityMapper;
import com.quartz.SpringBootQuartz.service.JobEntityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service()
public class JobEntityServiceImpl implements JobEntityService {
    @Autowired
    private JobEntityMapper jobEntityMapper;
    @Override
    public List<JobEntity> findByCriteria(JobEntity jobEntity) throws Exception {
        return jobEntityMapper.findByCriteria(jobEntity);
    }

    @Override
    public List<String> findStatus() throws Exception {
        List<String> status = jobEntityMapper.findStatus();
        for (String s:status
             ) {
            System.out.println(s);
        }
        return status;
    }

    @Override
    public List<Cron> findCrons() throws Exception {
        List<Cron> crons = jobEntityMapper.findCrons();
        for (Cron c:crons
             ) {
            System.out.println(c.getName());
        }
        return crons;
    }

    @Override
    public List<Integer> findId(Integer id) throws Exception {
        return jobEntityMapper.findId(id);
    }

    @Override
    public List<JobEntity> findById(Integer id) throws Exception {
        return jobEntityMapper.findById(id);
    }

    @Override
    public Integer add(JobEntity jobEntity) throws Exception {
        return jobEntityMapper.add(jobEntity);
    }

    @Override
    public Integer updateById(JobEntity jobEntity) throws Exception {
        return jobEntityMapper.updateById(jobEntity);
    }

    @Override
    public Integer deleteById(Integer id) throws Exception {
        return jobEntityMapper.deleteById(id);
    }

    @Override
    public List<String> findGroups() throws Exception {
        return jobEntityMapper.findGroups();
    }
}
